<div id="a-repository-detail" class="modal fade">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">A仓库</h4>
            </div>
            <div class="modal-body">
                <form id="a-repository-form" action='{:U("Admin/Repository/updateARepository")}' method="post">
                    <div class="row">
                    <div class="col-sm-12">
                        <div class="col-sm-1"></div>
                        <div class="col-sm-3" style="padding-top:5px">
                            <label for="b_repository_id" class="control-label">所属B类仓库：</label>
                        </div>
                        <div class="col-sm-6">
                            <select id="b_repository_id" name="b_repository_id" class="form-control">
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <br>
                        <div class="col-sm-1"></div>
                        <div class="col-sm-3" style="padding-top:5px">
                            <label for="name" class="control-label">仓库名称：</label>
                        </div>
                        <div class="col-sm-6">
                            <input name="a_repository_id" class="form-control" style="display:none;"></input>
                            <input id="name" name="name" class="form-control"></input>
                        </div>
                    </div>

                    <div class="col-sm-12">
                        <br>
                        <div class="col-sm-1"></div>
                        <div class="col-sm-3" style="padding-top:5px">
                            <label for="position" class="control-label">仓库地址：</label>
                        </div>
                        <div class="col-sm-6">
                            <input name="position" class="form-control"></input>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <br>
                        <div class="col-sm-1"></div>
                        <div class="col-sm-3" style="padding-top:5px">
                            <label for="linkman" class="control-label">联系人：</label>
                        </div>
                        <div class="col-sm-6">
                            <input name="linkman" class="form-control"></input>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <br>
                        <div class="col-sm-1"></div>
                        <div class="col-sm-3" style="padding-top:5px">
                            <label for="phone" class="control-label">联系电话：</label>
                        </div>
                        <div class="col-sm-6">
                            <input name="phone" class="form-control"></input>
                        </div>
                    </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary" onclick="submit()">保存</button>
                <button class="btn btn-defalt" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<script>
$('#a-repository-detail').on("hidden.bs.modal",function(e){
    $("input[name='a_repository_id']").attr('value', '');
    $("input[name='name']").attr('value',"");
    $("input[name='position']").attr('value', '');
    $("input[name='linkman']").attr('value', '');
    $("input[name='phone']").attr('value', '');
}); 

function submit(){
    if($('#name').val() == ''){
        alert('请填写仓库名称！');
        return;
    }
    $('#a-repository-form').ajaxSubmit({
        success:function(data){
            $('#a-repository-detail').modal('hide');
            location.reload();
        }
    });
}
</script>